<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header('新增道具')"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-fantasyItemtype-add" enctype="multipart/form-data">
			<div class="form-group">	
				<label class="col-sm-3 control-label">道具名称：</label>
				<div class="col-sm-8">
					<input id="name" name="name" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">道具类型：</label>
				<div class="col-sm-8">
					<select class="form-control" name="itemType" th:with="type=${@dict.getType('item_type')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">耐久：</label>
				<div class="col-sm-8">
					<input id="durability" name="durability" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">冷却时间：</label>
				<div class="col-sm-8">
					<input id="coolingTime" name="coolingTime" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">容量：</label>
				<div class="col-sm-8">
					<input id="capacity" name="capacity" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">称号：</label>
				<div class="col-sm-8">
					<select id="title" name="title" class="form-control">
						<option value="-1">请选择</option>
						<option th:each="fantasyTitle:${fantasyTitleList}" th:alt-title="${fantasyTitle.describe}" th:value="${fantasyTitle.id}" th:text="${fantasyTitle.title}" value="1">
							aaa
						</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">最低熟练度：</label>
				<div class="col-sm-8">
					<input id="mastery" name="mastery" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">材料：</label>
				<div class="col-sm-8">
					<input id="material" name="material" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">道具描述：</label>
				<div class="col-sm-8">
					<textarea id="itemDesc" name="itemDesc" class="form-control" type="text"></textarea>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">稀有：</label>
				<div class="col-sm-8">
					<select id="rarely" name="rarely" class="form-control">
						<option value="0">否</option>
						<option value="1">是</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">道具图片：</label>
				<div class="col-sm-8">
					<input id="item" name="item" class="form-control" type="file" accept="image/*">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">初始化：</label>
				<div class="col-sm-8">
					<select id="ground" name="ground" class="form-control">
						<option value="0">否</option>
						<option value="1">是</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">装备：</label>
				<div class="col-sm-8">
					<select id="equip" name="equip" class="form-control">
						<option value="0">否</option>
						<option value="1">是</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">使用：</label>
				<div class="col-sm-8">
					<select id="usable" name="usable" class="form-control">
						<option value="0">否</option>
						<option value="1">是</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">安装：</label>
				<div class="col-sm-8">
					<select id="placement" name="placement" class="form-control">
						<option value="0">否</option>
						<option value="1">是</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">任务：</label>
				<div class="col-sm-8">
					<select id="task" name="task" class="form-control">
						<option value="0">否</option>
						<option value="1">是</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">所属城市：</label>
				<div class="col-sm-8">
					<select id="belongsCity" name="belongsCity" class="form-control">
						<option value="0">全部</option>
						<option th:each="city:${cities}" th:alt-title="${city.citydesc}" th:value="${city.id}" th:text="${city.cityname}" value="1">
							aaa
						</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">所属商店：</label>
				<div class="col-sm-8">
					<select id="belongsShop" name="belongsShop" class="form-control">
						<option value="0">全部</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">道具等级：</label>
				<div class="col-sm-8">
					<input id="itemLevel" name="itemLevel" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">影响范围：</label>
				<div class="col-sm-8">
					<input id="scope" name="scope" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">影响属性：</label>
				<div class="col-sm-8">
					<input id="property" name="property" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">属性变动值：</label>
				<div class="col-sm-8">
					<input id="propertyVal" name="propertyVal" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注信息：</label>
				<div class="col-sm-8">
					<textarea id="remark" name="remark" class="form-control"></textarea>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "fantasy/fantasyItemtype"
		$("#form-fantasyItemtype-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
				var url = prefix + "/add";
                $.modal.loading("正在处理中，请稍后...");
                var formdata = new FormData($('#form-fantasyItemtype-add')[0]);
                //formdata.append("item", $('#item'));
                var config = {
                    url: url,
                    type: "post",
                    dataType: "json",
                    data: formdata,
                    processData: false,
                    contentType: false,
                    success: function(result) {
                        $.operate.successCallback(result);
                    }
                };
                $.ajax(config)

	            //$.operate.saveMulti(prefix + "/add", $('#form-fantasyItemtype-add').serialize());
	        }
	    }
	</script>
</body>
</html>
